<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>图片所见即所得编辑</title>
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
        height: 100%;
        overflow: hidden;
      }
      #markdown {
        margin-top: 5%;
        width: 70%;
        margin-left: auto;
        margin-right: auto;
      }
    </style>
    <link rel="stylesheet" type="text/css" href="../packages/cherry-markdown/dist/cherry-markdown.css" />
    <link rel="Shortcut Icon" href="./logo/favicon.ico" />
    <link rel="Shortcut Icon" href="../logo/favicon.ico" />
    <link rel="Bookmark" href="../logo/favicon.ico" />
  </head>

  <body>
    <div id="dom_mask" style="position: absolute; top: 40px; height: 20px; width: 100%"></div>
    <div id="markdown"></div>
    <script src="../packages/cherry-markdown/dist/cherry-markdown.js"></script>
    <script type="module">
         // 使用 fetch 获取 markdown 文件内容
        const response = await fetch('./assets/markdown/img.md');
        const imgMd = await response.text();

       import { imgConfig } from './assets/scripts/img-demo.js';
      // 在Vite中使用?raw导入的文件内容已经是字符串，无需通过fetch获取
      const config = Object.assign({}, imgConfig, { value: imgMd });
      window.cherry = new Cherry(config);
    </script>
  </body>
</html>
